<script setup lang="ts">
    import {inject} from 'vue'
    //在后代组件中通过`inject`配置来声明接收数据
   const d = inject(['dog-options'])
   const {username,changeUsername} = inject(['username-options'])
    
</script>
<template>
    <h3>provides-inject-孙组件</h3>
    <h4>来自于祖父组件的数据:{{ d }}-{{ username }}</h4>
    <button @click="changeUsername('孙子')">孙给祖父</button>
</template>
<style scoped>
   
</style>